import java.util.LinkedHashMap;
import java.util.Map;

class Solution {
  public char firstUniqChar(String s) {
    Map<Character, Boolean> map = new LinkedHashMap<>();
    for (int i = 0; i < s.length(); i++) {
      if (map.get(s.charAt(i)) != null) {
        map.put(s.charAt(i), false);
      } else {
        map.put(s.charAt(i), true);
      }
    }
    for (Map.Entry<Character, Boolean> e : map.entrySet()) {
      if (e.getValue()) {
        return e.getKey();
      }
    }
    return ' ';
  }

  public static void main(String[] args) {
    char c = new Solution().firstUniqChar("abcabcaa");
    System.out.println(c);
  }
}